package com.enterprise.struts2.employee;

import com.enterprise.daoImpl.EmployeeDaoImpl;
import com.enterprise.domain.Employee;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

public class EmployeeAction extends ActionSupport implements ModelDriven<Employee> {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Employee employee=new Employee();
	
	public Employee getEmployee() {
		return employee;
	}

	public void setEmployee(Employee employee) {
		this.employee = employee;
	}

	@Override
	public Employee getModel() {
		// TODO Auto-generated method stub
		return employee;
	}
	private EmployeeDaoImpl employeeDaoImpl=new EmployeeDaoImpl();
	public String add(){
		if(employeeDaoImpl.addEmployee(employee)>0)
			return "success";
		else {
			return "input";
		}
	}
	
	public String delete(){
		if(employeeDaoImpl.deleteEmployee(employee)>0)
			return "success";
		else {
			return "input";
		}
	}
}
